package com.framework.service.config.initMinio;

import io.minio.MinioClient;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @author 龘鵺
 * @className com.framework.service.config.initMinio
 * @description 文件服务器配置类
 * @datetime 2024-07-05 17:01:06
 * @version 1.0
 */
@Configuration
public class MinioConfig {
    /**
     * 文件服务器地址
     */
    @Value("${custom.minio.upload-address}")
    private String url;
    /**
     * 帐号
     */
    @Value("${custom.minio.accessKey}")
    private String accessKey;
    /**
     * 密码
     */
    @Value("${custom.minio.secretKey}")
    private String secretKey;

    /**
     * @return io.minio.MinioClient
     * @title 初始化文件服务器
     * @description 初始化文件服务器
     * @author 龘鵺
     * @datetime 2022-01-09 11:11:11
     */
    @Bean
    public MinioClient getMinioClient() {
        MinioClient minioClient = MinioClient.builder().endpoint(url)
                .credentials(accessKey, secretKey).build();
        return minioClient;
    }
}
